<!DOCTYPE HTML>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0, minimum-scale=1.0, user-scalable=0, initial-scale=1.0, width=device-width" />
    <meta name="format-detection" content="telephone=no, email=no, date=no, address=no">
    <title>修改物料</title>
    <link rel="stylesheet" type="text/css" href="../css/mui.min.css" />
    <link rel="stylesheet" type="text/css" href="../css/common.css" />
    <link rel="stylesheet" href="../css/page_css/util.css">
    <style type="text/css">
        .mui-table-view-chevron .mui-table-view-cell {
            padding-right: 20px!important;
        }

        h5 {
            color: #0062CC;
        }

        .mui-navigate-right .mui-col-xs-8 {
            width: 62.666667%!important;
        }

        .mui-text-right input,
        .mui-text-right textarea,
        textarea {
            border: 0;
            font-size: 14px;
            font-weight: 400;
            color: #8f8f94;
            margin-bottom: 0;
            text-align: right;
            height: auto;
            padding: 0;
        }

        textarea {
            text-align: left;
        }
    </style>
</head>

<body>
    <div class="mui-content">
        <ul class="mui-table-view mui-table-view-chevron">
            <li class="mui-table-view-cell">
                <div class="mui-table">
                    <div class="mui-table-cell mui-col-xs-4">
                        <h5 class="mui-ellipsis">SGMW ID：</h5>
                    </div>
                    <div class="mui-table-cell mui-col-xs-8 mui-text-right">
                        <span class="mui-h5" id="itemnum"></span>
                    </div>
                </div>
            </li>
            <li class="mui-table-view-cell" onclick="openStock('work_order_sel_stock','选择库房')">
                <div class="mui-table mui-navigate-right">
                    <div class="mui-table-cell mui-col-xs-4">
                        <h5 class="mui-ellipsis">仓库：</h5>
                    </div>
                    <div class="mui-table-cell mui-col-xs-8 mui-text-right">
                        <span class="mui-h5" id="cAssetAd"></span>
                    </div>
                </div>
            </li>
            <li class="mui-table-view-cell detail">
                <div class="mui-table">
                    <div class="mui-table-cell mui-col-xs-4">
                        <h5 class="mui-ellipsis">库存地址：</h5>
                    </div>
                    <div class="mui-table-cell mui-col-xs-8 mui-text-right">
                        <input type="text" id="dfltstagebin" placeholder="请输入库存地址" />
                    </div>
                </div>
            </li>
            <li class="mui-table-view-cell detail">
                <div class="mui-table">
                    <div class="mui-table-cell mui-col-xs-4">
                        <h5 class="mui-ellipsis">描述：</h5>
                    </div>
                    <div class="mui-table-cell mui-col-xs-8 mui-text-right">
                        <input type="text" id="description" placeholder="请输入默认描述" />
                    </div>
                </div>
            </li>
            <li class="mui-table-view-cell detail">
                <div class="mui-table">
                    <div class="mui-table-cell mui-col-xs-4">
                        <h5 class="mui-ellipsis">规格：</h5>
                    </div>
                    <div class="mui-table-cell mui-col-xs-8 mui-text-right">
                        <input type="text" id="cSpcifications" placeholder="请输入默认规格" />
                    </div>
                </div>
            </li>
            <li class="mui-table-view-cell detail">
                <div class="mui-table">
                    <div class="mui-table-cell mui-col-xs-4">
                        <h5 class="mui-ellipsis">部件制造号：</h5>
                    </div>
                    <div class="mui-table-cell mui-col-xs-8 mui-text-right">
                        <input type="text" id="cMPNum" placeholder="请输入部件制造号" />
                    </div>
                </div>
            </li>
            <li class="mui-table-view-cell detail">
                <div class="mui-table">
                    <div class="mui-table-cell mui-col-xs-4">
                        <h5 class="mui-ellipsis">部件制造商：</h5>
                    </div>
                    <div class="mui-table-cell mui-col-xs-8 mui-text-right">
                        <input type="text" id="cM" placeholder="请输入部件制造商" />
                    </div>
                </div>
            </li>
            <li class="mui-table-view-cell detail">
                <div class="mui-table">
                    <div class="mui-table-cell mui-col-xs-4">
                        <h5 class="mui-ellipsis">部件制造商订货号：</h5>
                    </div>
                    <div class="mui-table-cell mui-col-xs-8 mui-text-right">
                        <input type="text" id="cMPId" placeholder="请输入部件制造商订货号" />
                    </div>
                </div>
            </li>
            <li class="mui-table-view-cell detail">
                <div class="mui-table">
                    <div class="mui-table-cell mui-col-xs-4">
                        <h5 class="mui-ellipsis">序列号：</h5>
                    </div>
                    <div class="mui-table-cell mui-col-xs-8 mui-text-right">
                        <input type="text" id="cSerialno" placeholder="请输入序列号" />
                    </div>
                </div>
            </li>
            <li class="mui-table-view-cell detail">
                <div class="mui-table">
                    <div class="mui-table-cell mui-col-xs-4">
                        <h5 class="mui-ellipsis">图纸号：</h5>
                    </div>
                    <div class="mui-table-cell mui-col-xs-8 mui-text-right">
                        <input type="text" id="cDrawingnum" placeholder="请输入图纸号" />
                    </div>
                </div>
            </li>
            <li class="mui-table-view-cell detail">
                <div class="mui-table">
                    <div class="mui-table-cell mui-col-xs-4">
                        <h5 class="mui-ellipsis">是否关键备件：</h5>
                    </div>
                    <div class="mui-table-cell mui-col-xs-8 mui-text-right">
                      <select class="mui-h5" style="direction:rtl;margin:auto;padding:0" id="cKeySparepart">
                         <option value="1">是</option>
                         <option value="0">否</option>
                       </select>
                    </div>
                </div>
            </li>
            <li class="mui-table-view-cell detail">
                <div class="mui-table">
                    <div class="mui-table-cell mui-col-xs-4">
                        <h5 class="mui-ellipsis">OEM订货号：</h5>
                    </div>
                    <div class="mui-table-cell mui-col-xs-8 mui-text-right">
                        <input type="text" id="cOemid" placeholder="请输入OEM订货号" />
                    </div>
                </div>
            </li>
            <li class="mui-table-view-cell detail">
                <div class="mui-table">
                    <div class="mui-table-cell mui-col-xs-4">
                        <h5 class="mui-ellipsis">当前库存数：</h5>
                    </div>
                    <div class="mui-table-cell mui-col-xs-8 mui-text-right">
                        <input type="text" id="physcnt" placeholder="请输入当前库存数" />
                    </div>
                </div>
            </li>
            <li class="mui-table-view-cell detail">
                <div class="mui-table">
                    <div class="mui-table-cell mui-col-xs-4">
                        <h5 class="mui-ellipsis">当前库存价格：</h5>
                    </div>
                    <div class="mui-table-cell mui-col-xs-8 mui-text-right">
                        <input type="text" id="stdcost" placeholder="请输入当前库存价格" />
                    </div>
                </div>
            </li>
        </ul>
    </div>
</body>
<script type="text/javascript" src="../script/api.js"></script>
<script src="../script/mui.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../script/common.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
  apiready = function() {
    onLoadData();
    api.addEventListener({
        name:'navitembtn'
    },function(ret, err){
        if(ret.type == 'right'){
          if(!$api.html($api.byId('cAssetAd'))){
            Toast('请选择仓库');
            return false
          }
//        if(!$api.val($api.byId('dfltstagebin'))){
//          Toast('请输入默认货柜');
//          return false
//        }
          /*if(!$api.val($api.byId('description'))){
            Toast('请输入描述');
            return false
          }
          if(!$api.val($api.byId('cSpcifications'))){
            Toast('请输入规格');
            return false
          }
          if(!$api.val($api.byId('cMPNum'))){
            Toast('请输入部件制造号');
            return false
          }
          if(!$api.val($api.byId('cM'))){
            Toast('请输入部件制造商');
            return false
          }
          if(!$api.val($api.byId('cMPId'))){
            Toast('请输入订货号');
            return false
          }
          if(!$api.val($api.byId('cSerialno'))){
            Toast('请输入序列号');
            return false
          }
          if(!$api.val($api.byId('cDrawingnum'))){
            Toast('请输入图纸号');
            return false
          }
          if(!$api.val($api.byId('cKeySparepart'))){
            Toast('请选择是否是关键备件');
            return false
          }
          if(!$api.val($api.byId('cOemid'))){
            Toast('请输入OEM订货号');
            return false
          }
          if(!$api.val($api.byId('physcnt'))){
            Toast('请输入当前库存');
            return false
          }
          if(!$api.val($api.byId('stdcost'))){
            Toast('请输入当前库存价格');
            return false
          }*/
          ajaxrd("updateItem", {
              itemid: api.pageParam.itemid,
              cAssetAd:$api.html($api.byId('cAssetAd')),
              dfltstagebin:$api.val($api.byId('dfltstagebin')),
              description:$api.val($api.byId('description')),
              cSpcifications:$api.val($api.byId('cSpcifications')),
              cMPNum:$api.val($api.byId('cMPNum')),
              cM:$api.val($api.byId('cM')),
              cMPId:$api.val($api.byId('cMPId')),
              cSerialno:$api.val($api.byId('cSerialno')),
              cDrawingnum:$api.val($api.byId('cDrawingnum')),
              cKeySparepart:$api.val($api.byId('cKeySparepart')),
              cOemid:$api.val($api.byId('cOemid')),
              physcnt:$api.val($api.byId('physcnt')),
              stdcost:$api.val($api.byId('stdcost'))
          }, function(data) {
              api.sendEvent({
                  name: 'renovate',
                  extra: {
                      isRenovate: 'true'
                  }
              });
              setTimeout(function() {
                  api.closeWin();
              }, 100)
          })
        }
      });
      api.addEventListener({
          name: 'chooseStock'
      }, function(ret, err) {
        $api.html($api.byId('cAssetAd'),ret.value.stockId)
      });
    }
    function onLoadData() {
        ajaxrd("queryItemDetail", {
            inventoryid: api.pageParam.inventoryid
        }, function(data) {
            $api.html($api.byId('itemnum'),data.itemnum)
            $api.html($api.byId('cAssetAd'),data.location)
            $api.val($api.byId('dfltstagebin'),data.binnum)
            $api.val($api.byId('description'),data.description)
            $api.val($api.byId('cSpcifications'),data.cSpcifications)
            $api.val($api.byId('cMPNum'),data.cMPNum)
            $api.val($api.byId('cM'),data.cM)
            $api.val($api.byId('cMPId'),data.cMPId)
            $api.val($api.byId('cSerialno'),data.cSerialno)
            $api.val($api.byId('cDrawingnum'),data.cDrawingnum)
            //$api.val($api.byId('cKeySparepart'),data.cKeySparepart)
            
            document.getElementById('cKeySparepart').value = data.cKeySparepart;
            $api.val($api.byId('cOemid'),data.cOemid)
            $api.val($api.byId('physcnt'),data.curbal)
            $api.val($api.byId('stdcost'),data.stdcost)
        })
    }
    function openStock(){
  		openWin('work_order_sel_stock','选择库房',{
	        background: '#6098de',
	        color: '#fff',
	        rightButtons:[{
	        	iconPath:"widget://image/save-icon.png"
	        }]
	    })
  	}
</script>

</html>
